#!/usr/bin/env node
const http=require('https'),
      url =require('require'),
      log=console.log,
      city=process.argv[2] || '石家庄' ,
      addr='https://api.66mz8.com/api/weather.php?location='+city;
      //addr='https://api.66mz8.com/api/weather.php?location=%e7%9f%b3%e5%ae%b6%e5%ba%84';
log(addr);
process.exit();
let opt=url.parse(addr);
opt.headers={
  'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36'
};
http.get(opt,(res)=>{
  log(`HTTP/${res.http} ${res.statusCode} ${res.statusMessage}`);  
  log(res.headers);
  res.pipe(process.stdout);
});
